//
//  SaveCell.m
//  收纳
//
//  Created by  on 2022/10/28.
//

#import "SaveCell.h"
@interface SaveCell()
@property (strong, nonatomic) IBOutlet UIView *bgView;
@property (strong, nonatomic) IBOutlet UITextView *input;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *saveTop;

@end
@implementation SaveCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (IBAction)actionForBtn:(UIButton *)sender {
    if (self.model.isContainer && self.input.text.length <= 0) {
        return [CCHud msg:@"请输入备注"];
    }
    if (self.block) {
        self.block();
    }
}
- (void)setModel:(Goods *)model{
    _model = model;
    self.input.text = _model.remark;
    self.input.hidden = !_model.isContainer;
    self.bgView.hidden = !_model.isContainer;
    self.saveTop.constant = _model.isContainer ? 220 : 60;
}
#pragma mark - UITextView
- (void)textViewDidChange:(UITextView *)textView{
    self.model.remark = textView.text;
}
@end
